//
import { AFlameCommonConfig } from '../../config/AFlameCommonConfig'
import { HrefConfig } from './HrefConfig'
// kxf   20/12/23 2:39 pm
//

export class IconConfig {
    height: number
    width: number
    type: string
    src: string
    text: string
    href: HrefConfig

    scal() {
        console.log("-----scal--------")
    }
}

/**
 * 鸡析图片src []
 * @param icon
 * @returns
 */
export function scaleIcon(icon: IconConfig): string {
    return scaleSrc(icon.src)
}

export function scaleSrc(src: string): string {
    if (src.startsWith("http")) {
        return src
    } else if (src.startsWith("[")) {
        let js = JSON.parse(src)
        return AFlameCommonConfig.OSS_HOST + js[0].url
    } else {
        return AFlameCommonConfig.OSS_HOST + src
    }
}